import { defineStore } from "pinia";
import { ref } from "vue";
export const useCounterStore = defineStore(
  "couter",
  () => {
    const num = ref(0);
    function changeNum() {
      num.value++;
    }
    return { num, changeNum };
  },
  {
    persist: {
      enabled: true, // 开启持久化
      strategies: [
        {
          key: "appStore", // 持久化的key
          storage: window?.localStorage, // 持久化的方式，可以选择sessionStorage
        },
      ],
    },
  }
);
